package com.origin.chaos.chat.bean.vo;

import com.origin.chaos.chat.bean.ChaosMessage;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Collections;
import java.util.List;

/**
 * @author: tao.ding
 * @date 2021-08-18
 */
@Data
public class ChaosMessages {
    @ApiModelProperty("下一次查询的索引")
    private long nextIndex;

    @ApiModelProperty("消息列表，老的消息在前")
    private List<ChaosMessage> messages;

    private static final ChaosMessages EMPTY = new ChaosMessages() {{
        setNextIndex(-1);
        setMessages(Collections.emptyList());
    }};

    public static ChaosMessages empty() {
        return EMPTY;
    }
}
